{% extends "admin/admin_base.html" %}
{% block content %}

<!--显示闪现的消息-->
{% with messages = get_flashed_messages() %}
{% if messages %}
<ur>
    {% for message in messages %}
    <div class="alert alert-success" style="text-align: center">
        <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
        <li>{{ message }}</li>
    </div>
    {% endfor %}
</ur>
{% endif %}
{% endwith %}

<h1>发文章</h1>
<form action="" method="post" enctype="multipart/form-data">
    {{ form.hidden_tag() }}
    <div class="form-group">
        <label>{{ form.post_pic.label }}</label>
        <input type="file" name="post_pic">
        {% for error in form.post_pic.errors %}
        <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </div>
    <div class="form-group">
        <label>{{ form.post_title.label }}</label>
        {{ form.post_title(size=100,class="form-control") }}<br>
        {% for error in form.post_title.errors %}
        <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </div>
    <div class="form-group">
        <label>{{ form.post_body.label }}</label>
        {{ form.post_body(cols=100, rows=10,class="form-control",id="post-content") }}<br>
        {% for error in form.post_body.errors %}
        <span style="color: red;">[{{ error }}]</span>
        {% endfor %}
    </div>
    <p>{{ form.submit(class="btn btn-primary") }}</p>
    </div>
</form>

{% endblock %}